<template>
  <div>
    <el-dialog
      title="签到列表"
      :visible.sync="dialogVisible"
      width="800px"
      :close-on-click-modal="false"
    >
      <div style="min-height: 500px">
        <el-table :data="tableData" stripe style="width: 100%" max-height="600">
          <el-table-column prop="studentInfo" label="姓名">
            <template slot-scope="{ row }">
              {{ row.sysUser.userName }}
            </template>
          </el-table-column>
          <el-table-column prop="signTime" label="签到时间" width="160">
          </el-table-column>

          <div slot="empty" class="emptyBg">
            <el-empty :image-size="200"></el-empty>
          </div>
        </el-table>
        <Pagination
          v-show="parseInt(pageObj.count) > 0"
          :total="parseInt(pageObj.count)"
          @change="getList"
          :page.sync="listQuery.page"
          :limit.sync="listQuery.limit"
        />
      </div>
      <span slot="footer" class="dialog-footer">
        <el-button @click="dialogVisible = false">取 消</el-button>
      </span>
    </el-dialog>
  </div>
</template>
<script>
export default {
  data() {
    return {
      dialogVisible: false,
      listQuery: {
        page: 1,
        limit: 10,
        signId: undefined,
      },
      tableData: [],
      pageObj: {},
    }
  },
  mounted() {
    this.$bus.$on('showDialogSigninPersonList', (row) => {
      let { eduSignIn } = row
      if (!eduSignIn) return
      this.listQuery.signId = eduSignIn.id
      this.getList()
    })
  },
  beforeDestroy() {
    this.$bus.$off('showDialogSigninPersonList')
  },
  methods: {
    async getList() {
      let res = await this.$store.dispatch(
        'queryeduSignInPerson',
        this.listQuery,
      )
      this.tableData = res.data
      this.pageObj = res
      this.dialogVisible = true
    },
  },
}
</script>